package com.zz.yt.lib.bluetooth.delegate.printer;

import androidx.annotation.NonNull;

import com.landicorp.android.eptapi.device.Printer;
import com.landicorp.android.eptapi.device.Printer.Format;



public class AssistPrinterStep extends PrinterStep {

    public AssistPrinterStep(PrinterContent printerContent) {
        super(printerContent);
    }

    @Override
    protected void addTextContent(@NonNull Printer.Format format, @NonNull Printer printer) throws Exception {

        format.setAscScale(Printer.Format.ASC_SC1x1);
        format.setAscSize(Printer.Format.ASC_DOT24x12);
        format.setHzScale(Printer.Format.HZ_SC1x1);
        format.setHzSize(Format.HZ_DOT24x24);
        printer.setFormat(format);
        printer.printMid("违章停车\n");
        printer.printMid("----------------------------------\n");
        printer.printText("违法主体：" +" printerContent.getCostDetailsBean().getOrderNo()" + "\n");
        printer.printText("违法说明：" + "printerContent.getCostDetailsBean().getPaymentType()" + "\n");
        printer.printText("违法车辆：" + "printerContent.getCostDetailsBean().getCarNum()" + "\n");
        printer.printText("违法地点：" + "printerContent.getCostDetailsBean().getCarType()" + "\n");
        printer.printText("违法时间：" + "printerContent.getCostDetailsBean().getOutTime()" + "\n");
        printer.printText("处置状态：" + "printerContent.getCostDetailsBean().getCode()" + "\n");

    }

    @Override
    protected void addBarcodeContent(Printer printer) {

    }

    @Override
    protected void addQRCodeContent(Printer printer) {

    }

    @Override
    public boolean addContent() {
        boolean canPrint = true;

        // 打印信息
        if (!addText()) {
            canPrint = false;
        }

        if (!feedLine(12)) {
            canPrint = false;
        }

        if (!cutPage()) {
            canPrint = false;
        }

        return canPrint;
    }
}
